{%insert header.tpl%}
<script type="text/javascript" src="{% $THEME_URL %}/js/tiny_mce/jquery.tinymce.js"></script>
{%insert top.tpl%}
<h3>
{%iterate Path as url > title%}
<a href="{% q < url %}">{% i < title %}</a>&nbsp;|&nbsp;
{%iterate%}
{% i <  Title %}&nbsp;|&nbsp;
{%with ModelItem%}
{% context %}
{%endwith%}
</h3>
<script language="javascript" type="text/javascript">
	function show_tab(tab){
		var t = $(tab);
		t.parent().next().children().hide();
		$("#"+tab.id.replace("_tab","")+"_pane").show();
		t.parent().children().removeClass("active");
		t.addClass("active");
		$.cookie("<?php echo $this->PAGE->Name(); ?>_"+t.parent().attr("id"),t.attr("id"));
	}

	$(document).one("ready",function(){
		$(".tabs").each(function(){
			cv = $.cookie("<?php echo $this->PAGE->Name(); ?>_"+this.id);
			if (cv)
				show_tab($("#"+cv)[0]);
			else
				show_tab($(".tab",this)[0]);
		});
	});
</script>
<link type="text/css" href="{% $THEME_URL %}/css/product.css" rel="stylesheet" />
<div id="main_tabs" class="tabs">
<span id="content_tab" class="tab" onclick="javascript:show_tab(this);">Страница</span>
<span id="links_tab" class="tab" onclick="javascript:show_tab(this);">Связи</span>
<span id="images_tab" class="tab" onclick="javascript:show_tab(this);">Изображения</span>
{%iterate Modules as mn > m%}
<span id="{%mn%}_tab" class="tab" onclick="javascript:show_tab(this);">{% i < Caption %}</span>
{%iterate%}
</div>
<div class="panes">
<div class="pane" id="content_pane">
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="method" value="Save" />
<div class="btn-holder top-toolbar">
	<button type="button" class="submit-btn" onclick="javascript:submit();return false;">{% i <  SaveActionTitle %}</button>
	{%if ListUrl%}
	<button type="button" class="cancel-btn" onclick="javascript:window.location.href=&quot;{% q < ListUrl %}&quot;;return false;">{% i <  BackActionTitle %}</button>
	{%endif%}
</div>
<div class="pane-contents">
{%iterate Properties as property %}
<div class="field{%odd%} odd{%endodd%}">
	{%insert property.tpl%}
</div>
{%iterate%}
</div>
</form>
</div>
<div class="pane" id="links_pane" style="display:none;">
{%widget custom%}
</div>
<div class="pane" id="images_pane" style="display:none;">
<script type="text/javascript" language="javascript">
	function add_img_fld(){
		$("#img_add_area").append('<div><input class="add_img_fld" name="addimages['+$("input.add_img_fld").length+']" type="file"/><a href="#" onclick="javascript:add_img_fld(this);return false;">еще...</a></div>');
	}
</script>
{%with ModelItem%}
<form class="editor" method="post" enctype="multipart/form-data">
<input type="hidden" name="method" value="EditImages" />
<fieldset id="img_add_area">
<legend>Добавить изображения</legend>
<div><input class="add_img_fld" name="addimages[0]" type="file"/><a href="#" onclick="javascript:add_img_fld(this);return false;">еще...</a></div>
</fieldset>
<table id="imgs">
{%iterate Images as im%}
<tr>
	<td>
		{%with TinyThumbnail%}
		<a class="imageloader" href="{% q < GetLink %}"><img src="{% q < GetThumbnailLink %}" height="40" /></a>
		{%endwith%}
	</td>
	<td><textarea name="imagesdesc[{% ItemId %}]">{% q < Description %}</textarea></td>
	<td><input type="text" name="imagesorder[{% ItemId %}]" value="{% OrderNumber %}" /></td>
	<td><input type="checkbox" name="deleteimages[{% ItemId %}]" />Удалить</td>
</tr>
{%iterate%}
</table>
<div class="btn-holder"><button type="submit">{% i < `Save` %}</button></div>
</form>
{%endwith%}
</div>
{%iterate Modules as mn > m%}
<div class="pane" id="{% mn %}_pane">
{%widget mn%}
</div>
{%iterate%}
</div>
{%insert formfields.tpl%}
{%insert footer.tpl%}
